<?php

namespace App\Admin\Controllers;

use App\Admin\Controllers\layout\GoodPackLeft;
use App\Admin\Controllers\layout\GoodPackRight;
use App\Http\Controllers\Controller;
use App\Models\TongGood;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Widgets\Box;
use Dcat\Admin\Widgets\Card;
use Dcat\Admin\Widgets\Table;
use http\Message\Body;
use Dcat\Admin\Layout\Row;

/**
 * 商品套餐
 */
class TongGoodPackController extends Controller
{
    /**
     * @return Content
     */
    public function index(Content $content){
        return $content
            ->header('商品套餐')
            ->body(function(Row $row){
            $row->column(3,  $this->GoodPackLeft());
            $row->column(9, function (Column $column){
                $goods_list = TongGood::query()->get(['id','goods_name'])->toArray();
                $table = new Table();
                $table->setHeaders(['商品id','商品名称']);
                $table->setRows($goods_list);
                $column->append($table);
            });
        });
    }


    /**
     * 套餐左边
     * @return Card
     */
    public function GoodPackLeft(){
        return new Card('1231232','csvdsvds');
    }

    public function GoodPackRight(){

    }
}
